<div [@routerTransition]>
    <div class="m-subheader ">
        <div class="d-flex align-items-center">
            <div class="mr-auto col-xs-6">
                <h3 class="m-subheader__title m-subheader__title--separator">
                    <span>存放位置</span>
                </h3>
                <span class="m-section__sub"> 存放位置的文本头信息 </span>
            </div>
            <div class="col-xs-6 text-right" *ngIf="isGranted('Mes51.Pages.Material.Location.Caret')">
                <button
                    (click)="createOrEditLocationModal.show()"
                    class="btn btn-primary blue"
                >
                    <i class="fa fa-plus"></i> 创建新的基类
                </button>
            </div>
        </div>
    </div>

    <div class="m-content classification-content">
        <div class="m-portlet m-portlet--mobile">
            <div class="m-portlet__body">
                <div class="row align-items-center">
                    <!--<Primeng-TurboTable-Start>-->
                    <div
                        class="primeng-datatable-container"
                        [busyIf]="primengTableHelper.isLoading"
                    >
                        <p-treeTable [value]="areas">
                            <ng-template pTemplate="header">
                                <tr>
                                    <th style="width: 150px;">名称</th>
                                    <th style="width: 150px;" *ngIf="isGranted('Mes51.Pages.Material.Location.Caret')">操作</th>
                                </tr>
                            </ng-template>
                            <ng-template
                                pTemplate="body"
                                let-rowNode
                                let-rowData="rowData"
                            >
                                <tr [ttRow]="rowNode">
                                    <td>
                                        <p-treeTableToggler
                                            [rowNode]="rowNode"
                                            style="color: #5867dd;"
                                        >
                                        </p-treeTableToggler>
                                        {{ rowData.displayName }}
                                    </td>
                                    <td *ngIf="isGranted('Mes51.Pages.Material.Location.Caret')">
                                        <div
                                            class="btn-group dropdown"
                                            dropdown
                                            container="body"
                                        >
                                            <button
                                                dropdownToggle
                                                class="dropdown-toggle btn btn-sm btn-primary"
                                            >
                                                <i class="fa fa-cog"></i
                                                ><span class="caret"></span>
                                                {{ 'Actions' | localize }}
                                            </button>
                                            <ul
                                                class="dropdown-menu"
                                                *dropdownMenu
                                            >
                                                <li>
                                                    <a
                                                        (click)="
                                                            createOrEditLocationModal.show(
                                                                '',
                                                                rowData.id,
                                                                rowData.displayName
                                                            )
                                                        "
                                                        >创建子类</a
                                                    >
                                                </li>
                                                <li>
                                                    <a
                                                        (click)="
                                                            createOrEditLocationModal.show(
                                                                rowData.id
                                                            )
                                                        "
                                                        >编辑</a
                                                    >
                                                </li>
                                                <li>
                                                    <a
                                                        (click)="
                                                            deleteLocation(
                                                                rowData
                                                            )
                                                        "
                                                        >删除</a
                                                    >
                                                </li>
                                            </ul>
                                        </div>
                                    </td>
                                </tr>
                            </ng-template>
                        </p-treeTable>
                    </div>
                    <!--<Primeng-TurboTable-End>-->
                </div>
            </div>
        </div>
    </div>
    <createOrEditLocationModal
        #createOrEditLocationModal
        (modalSave)="getAreas()"
    ></createOrEditLocationModal>
</div>
